package StudyCode.summary.mycollection;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class TransposeTwoDimensionalBooleanArray {
	public static boolean[][] transpose(boolean[][] array) {
		if (array == null || array.length == 0 || array[0].length == 0) {
			throw new RuntimeException("Null or empty array");
		}

		boolean[][] transposed = new boolean[array[0].length][array.length];

		for (int i = 0; i < transposed.length; i++) {
			for (int j = 0; j < array.length; j++) {
				transposed[i][j] = array[j][i];
			}
		}
		return transposed;
	}
}
